home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Is this ok: *pointer++ = value ??
- Date: Sun, 07 Jan 96 00:29:08 GMT
- Organization: none
- Message-ID: <820974548snz@genesis.demon.co.uk>
- References: <4cklvv$nmm@alcor.usc.edu> <4cmmcd$e3u@gryphon.phoenix.net>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4cmmcd$e3u@gryphon.phoenix.net>
- brucew@phoenix.net "Bruce Wedding" writes:
-
- >wawda@alcor.usc.edu (Abu Wawda) wrote:
- >
- >> for (i=0; i<50; i++) *pointer++ = i;
- >
- >>My only problem is why? I mean you aren't allowed to do:
- >
- >> for (i=0; i<50; i++) p++ = i;
- >
- >Sure you can do that. You are assigning addresses to the pointer. It
- >probably isn't too smart, but it is legal.
-
- No it isn't. p++ is not an lvalue in C and hence can't appear on the left
- of an assignment. *pointer++ is equivalent to *(pointer++) and is an lvalue
- and hence can appear on the left (as long as it is modifiable).
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-